package com.zhs.xyzsdk.builder;

import com.zhs.javacc.ParseException;

public class XYZParseException {

	String message;
	int line;

	/**
	 * 
	 */
	private static final long serialVersionUID = 6337424928332840632L;

	public String getMessage() {
		return message;
	}

	public int getLineNumber() {
		return line;
	}

	public XYZParseException(ParseException e) {
		this.message = e.getMessage();
		this.line = e.currentToken.next.beginLine;
	}

	public XYZParseException(Error e) {
		this.message = e.getMessage();
		int index1 = message.indexOf("error at line ");
		int index2 = message.indexOf(", column ");
		String temp = message.substring(index1 + 14, index2);
		line = Integer.parseInt(temp);
	}
}
